﻿IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[vRptClassLookup]'))
DROP VIEW [vRptClassLookup]
go
create view [vRptClassLookup] as 
select '' as id, ' -- ΟΛΕΣ --' +' ('
+ (select CAST(COUNT(*) as varchar(10)) from claims s ) + ')' as Description 
          union
select RTRIM(CODE) as id, 
RTRIM(CODE) + ' - ' + RTRIM(DESCR) +' ('
+ (select CAST(COUNT(*) as varchar(10)) from claims s where s.class_cd=CODE) + ')' as Description 
from dbo.CLASS
go
